package work1;

import java.util.Objects;

public class Student {
    private String ID;//学号
    private String name;//姓名
    private String sex;//性别
    private String subject;//专业
    private String grade;//年级

    public Student(String ID, String name, String sex, String subject, String grade) {
        this.ID = ID;
        this.name = name;
        this.sex = sex;
        this.subject = subject;
        this.grade = grade;
    }

    public Student(){

    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Student student = (Student) o;
        return Objects.equals(ID, student.ID) && Objects.equals(name, student.name) && Objects.equals(sex, student.sex) && Objects.equals(subject, student.subject) && Objects.equals(grade, student.grade);
    }

    @Override
    public int hashCode() {
        return Objects.hash(ID, name, sex, subject, grade);
    }

    @Override
    public String toString() {
        return "Student{" +
                "学号:'" + ID + '\'' +
                ", 姓名:'" + name + '\'' +
                ", 性别:'" + sex + '\'' +
                ", 学科:'" + subject + '\'' +
                ", 系:'" + grade + '\'' +
                '}';
    }

    //访问器
    public String getID() {
        return ID;
    }

    public void setID(String ID) {
        this.ID = ID;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getGrade() {
        return grade;
    }

    public void setGrade(String grade) {
        this.grade = grade;
    }
}
